﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Data;
using KPIS.GERP.GHRMS.MODEL;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.DAL;

namespace KPIS.GERP.GHRMS.BLL
{
    public sealed class TimeAttendantsBLL:ITimeAttendantsBLL
    {
        private TimeAttendantDAL DAL = new TimeAttendantDAL();

        public int GetMissWorkingDays(string month, string year, string emp_seq)
        {
            return DAL.GetActualWorkingDays(month, year, emp_seq);
        }

        public int GetActualWorkingDays(string month, string year, string emp_seq)
        {
            return DAL.GetActualWorkingDays(month, year , emp_seq);
        }

        public string GetEmpSequence(string CodeScan)
        {
            return DAL.GetEmpSequence(CodeScan);
        }

        public bool CheckDuplicate(string EmpSequence, string WorkingDate)
        {
            return DAL.CheckDuplicate(EmpSequence, WorkingDate);
        }

        public bool CheckDupTimeAttMonly(string EmpSequence, string Month, string Year)
        {
            return DAL.CheckDupTimeAttMonly(EmpSequence, Month, Year);
        }

        public DataSet LoadTimeAttendants(string EmployeeType, string WorkingDate, string WorkingJobSiteSeq, string EmpSequence)
        {
            return DAL.LoadTimeAttendants(EmployeeType, WorkingDate, WorkingJobSiteSeq, EmpSequence);
        }

        public IList<TimeAttendantInfo> LoadTimeAttendants_NewMod(string WorkingDate, string EmpSequence)
        {
            return DAL.LoadTimeAttendants_NewMod(WorkingDate, EmpSequence);
        }

        public IList<TimeAttendantInfo> GetEmpSeqDist(string month, string year)
        {
            return DAL.GetEmpSeqDist(month, year);
        }

        public IList<TimeAttendantInfo> GetTimeAtt_NonStatus(string month,string year)
        {
            return DAL.GetTimeAtt_NonStatus(month,year);
        }

        public int Insert(string WorkingDate, int EmpSeq, string WorkingStart, string WorkingEnd
                 , string WorkingStatus, string Remarks, int CreatedBy)
        {
            return DAL.Insert(WorkingDate, EmpSeq, WorkingStart, WorkingEnd
                 , WorkingStatus, Remarks, CreatedBy);
        }
        public int Update(int WorkingSeq, string WorkingDate, int EmpSeq
                , string WorkingStart, string WorkingEnd, string WorkingStatus
                , string Remarks, int UpdatedBy)
        {
            return DAL.Update(WorkingSeq, WorkingDate, EmpSeq, WorkingStart, WorkingEnd
                 , WorkingStatus, Remarks, UpdatedBy);
        }

        public int UpdateStatus(int WorkingSeq, string WorkingStatus, string Remarks, int UpdatedBy)
        {
            return DAL.UpdateStatus(WorkingSeq, WorkingStatus, Remarks, UpdatedBy);
        }

        public int Delete(int WorkingSeq, int UpdatedBy)
        {
            return DAL.Delete(WorkingSeq, UpdatedBy);
        }
        public DataSet LoadTimeAttMonthly(string empType, string WorkingJobSiteSeq, string year, string month)
        {
            return DAL.LoadTimeAttMonthly(empType, WorkingJobSiteSeq, year, month);
        }

        public int InsertTimeAttMonthly(string emp_seq, Nullable<int> working_month, Nullable<int> plan_working_day_count
            , Nullable<int> actual_working_day_count, Nullable<decimal> valid_absence_day_count
            , Nullable<decimal> invalid_absence_day_count, Nullable<int> late_day_count, Nullable<int> sick_day_count
            , Nullable<int> private_day_count, Nullable<int> vacation_day_count, Nullable<int> working_year, Nullable<int> sick_count
            , Nullable<int> quota_vacation, Nullable<int> deliver_day_count, Nullable<int> edu_day_count, Nullable<int> ordain_day_count
            , Nullable<int> temp_day_count, int CreatedBy, DateTime? CreatedWhen)
        {
            return DAL.InsertTimeAttMonthly(emp_seq, working_month, plan_working_day_count
                , actual_working_day_count, valid_absence_day_count, invalid_absence_day_count
                , late_day_count, sick_day_count, private_day_count, vacation_day_count, working_year
                , sick_count, quota_vacation, deliver_day_count, edu_day_count, ordain_day_count
                , temp_day_count, CreatedBy, CreatedWhen);
        }

        public int UpdateTimeAttMonthly(string emp_seq, Nullable<int> working_month, Nullable<int> plan_working_day_count
            , Nullable<int> actual_working_day_count, Nullable<decimal> valid_absence_day_count
            , Nullable<decimal> invalid_absence_day_count, Nullable<int> late_day_count, Nullable<int> sick_day_count
            , Nullable<int> private_day_count, Nullable<int> vacation_day_count, Nullable<int> working_year, Nullable<int> sick_count
            , Nullable<int> quota_vacation, Nullable<int> deliver_day_count, Nullable<int> edu_day_count, Nullable<int> ordain_day_count
            , Nullable<int> temp_day_count, int UpdatedBy, DateTime? UpatedWhen) 
        { 
            return DAL.UpdateTimeAttMonthly(emp_seq, working_month, plan_working_day_count
            , actual_working_day_count, valid_absence_day_count
            , invalid_absence_day_count, late_day_count, sick_day_count
            , private_day_count, vacation_day_count, working_year, sick_count
            , quota_vacation, deliver_day_count, edu_day_count, ordain_day_count
            , temp_day_count, UpdatedBy, UpatedWhen);
        }

        public int DeleteTimeAttMonthly(int Sequence, int UpdatedBy)
        {
            return DAL.DeleteTimeAttMonthly(Sequence, UpdatedBy);
        }
    }
}
